package net.hn.hnms.biz.meeting.mapper;

import net.hn.hnms.biz.meeting.domain.MeetingPerson;
import net.hn.hnms.biz.meeting.request.MeetingPersonReq;
import net.hn.hnms.biz.meeting.vo.MeetingPersonVo;
import net.hn.hnms.sys.common.mybatis.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface MeetingPersonMapper  extends BaseMapperPlus<MeetingPersonMapper, MeetingPerson, MeetingPersonVo> {

    @Select("<script>"+"select meeting_person_id,person_id, meeting_id,state,person_name from meeting_person where meeting_id = #{deptid.meetingId} and del_flag ='0' "+"</script>")
    List<MeetingPersonVo> selectListSq(@Param("deptid") MeetingPersonReq meetingPerson);



    @Update("<script>" +
            " update  hygl.meeting_person set state = '1' " +
            " where meeting_id in" +
            " <foreach collection=\"list\" item=\"value\" separator=\",\" open=\"(\" close=\")\">\n" +
            "#{value}" +
            "</foreach>" +
            "</script>")
    void updateDeleteByIds(@Param("list") List<String> list);


    @Update("<script>" +
            " update  hygl.meeting_person set del_flag = '1' " +
            " where meeting_id = #{id} " +
            "</script>")
    int updateDelByMeetingIds(@Param("id") String id);

    @Select("<script>"+"select meeting_person_id,person_id, meeting_id,state,person_name from meeting_person where del_flag='0' and meeting_id = #{deptid.meetingId} and person_id = #{deptid.personId}"+"</script>")
    MeetingPerson selectOne(@Param("deptid") MeetingPersonReq meetingPerson);



}
